import Vue from 'vue';

import VueRouter from 'vue-router';

Vue.use(VueRouter);
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

export default function createRouter() {
  return new VueRouter({
    mode: 'history',
    base: '/admin',
    routes: [
      
      {
        path: '/',
        redirect: '/index',
        component: () => import('../view/index.vue')
      },
      {
        path: '/index',
        component: () => import('../view/index.vue')
      },
      {
        path: '/book_type',
        component: () => import('../view/type.vue')
      },
      {
        path: '/book',
        component: () => import('../view/book.vue')
      },
      {
        path: '/user',
        component: () => import('../view/user.vue')
      },
      {
        path: '/lend',
        component: () => import('../view/lended_info.vue')
      },
      {
        path: '/announce',
        component: () => import('../view/announce.vue')
      },
      {
        path: '/suggest',
        component: () => import('../view/suggest.vue')
      },
      {
        path: '*', component: () => import('../view/notfound.vue')
      }
    ]
  });
}